<!-- 地址管理页面 -->
<template>
  <div class="address">
    <ul v-if="addressList.length>0">
        <li v-for="item in addressList" :key="item.id">
             {{item.name}} -- {{item.address}}{{item.address_detail}}
             {{item.mobile}}
        </li>
    </ul>
    <div v-else>暂无收货地址，请去添加</div>
    <van-button type="danger" size="large" @click="goAddOrUpdateAddress">新增地址</van-button>
  </div>
</template>

<script>
import {
    getListAction as getListActionApi
} from '@/api/address'
export default {
  name:'Address',
  data () {
    return {
        addressList:[]
    }
  },

  components: {},

  computed: {},

  created() {
    this.getAddressList()
  },

  mounted() {},

  methods: {
    async getAddressList(){
        let res = await getListActionApi({openId:localStorage.getItem('openId')})
        this.addressList = res.data
    }
    ,
    goAddOrUpdateAddress(){
        this.$router.push({name:'AddressDetail'})
    }
  }
}

</script>
<style lang='scss' scoped>
</style>